
<?php

if ($this->session->flashdata('message'))
    echo "<div class='message'>" . $this->session->flashdata('message') . "</div>";
$btn_search = array(
    'class' => 'btn btn-sm btn-primary btn-block',
    'value' => 'Buscar'
);

echo validation_errors('<div class="error">', '</div>');
$filtro = array('id' => 'filtro', 'name' => 'filtro', 'class' => 'form-control', 'value' => '', 'title' => 'buscar por [nombres,apellidos,cedula] de paciente');
echo form_open('cita_medica_controller/buscar_citas_medico');
echo '</br><div class="panel panel-default">';
echo ' <div class="panel-heading">';
echo '<h3 class="panel-title">Busqueda por criterio</h3>';
echo '</div>';
echo ' <div class="panel-body">';
echo '<div class="row-fluid">';
echo '<div class="col-sm-10">';
echo form_input($filtro);
echo '</div>';
echo '<div class="col-sm-2">';
echo form_submit($btn_search);
echo '</div>';
echo '</div>';
echo '</div>';
echo ' </div>';
echo '</br>';
echo form_close();
echo"<table>";
echo"<tr>";
echo"<td>";
echo '</div>';
echo"</td>";
echo"</tr>";
echo"</table>";


echo'<div class="panel panel-default">';
echo '<div class="panel-heading">Citas</div>';
echo '<div class="panel-body">';

if ($citas == null) {
    echo 'No Hay Citas';
} else {
    echo '<table cellpadding="0" cellspacing="0" border="1" class="table table-striped table-bordered table-condensed table-responsive" id="tblEspecialidades" width="100%">';
    echo "<thead>\n<tr>\n";
    echo "<th>Fecha</th><th>Hora Inicio</th><th>Fecha Fin</th><th>Paciente</th><th>Estado de pago</th><th>Estado</th><th>Atender</th>\n";
    foreach ($citas as $fila) {
        $btn_editar = array(
            'class' => 'btn btn-sm btn-primary btn-block',
            'value' => 'Eliminar'
        );
        echo "<tr valign='top'>\n";
        echo "<td align='left'>" . $fila['fecha'] . "</td>";
        echo "<td align='left'>" . $fila['hora_inicio'] . "</td>";
        echo "<td align='left'>" . $fila['hora_fin'] . "</td>";
        echo "<td align='left'>" . $fila['nombres'] . " " . $fila['apellidos'] . "</td>";
        if ($fila['pago'] == "0") {
            echo "<td align='left'>No cancelado</td>";
        } else {
            if ($fila['pago'] == "1") {
                echo "<td align='left'>Cancelado</td>";
            }
        }
        if ($fila['estado'] == "0") {
            echo "<td align='left'>En espera</td>";
        } else {
                echo "<td align='left'>Atendido</td>";
        }
        echo'<td align="left">';
        echo anchor("cita_medica_controller/atendido/" . $fila['id'], 'Atender', $btn_editar);
        echo "</tr>\n";
    }
    echo "</tbody></table>";
}
echo '</div></div>';
?>
